Timely updating and/or inserting data into a database is a critical function particularly, when data may be lost due to equipment failure. For example, in financial transactions, the recording of transactions, such as buying and selling stocks, may incur significant financial penalties if a transaction is lost or not properly recorded.
In the conventional database technology, there are a number of ways to insert and/or update (insert/update) data into database programmatically.
1) Single database connection with auto-commit turn on. In this case, inserting/updating data into database is executed in a sequential way and each inserting/updating operation is committed into the database before a next inserting/updating request being sent. The performance of inserting/updating in this case is limited by the network delay, database side JO (input/output) of each inserting/updating request.
2) Single database connection with batch commit mode. In this case, inserting/updating data into database is executed in a sequential way. However, multiple inserting/updating may be combined together before being committed. The database side JO number is reduced and the performance is better than the single database connection described above. However, each batch still needs to wait to be sent until the finish of the previous batch transaction.
3) Concurrent inserting/updating with multiple database connections or connection pool. In this case, database side will allocate resources to handle inserting/updating for each connection. However, it is up to the client side to schedule the inserting/updating transactions that not only take the advantage of multiple connections to improve the inserting/updating performance, but also to make sure that the inserting/updating data are committed efficiently and correctly.
There are also two sub-cases when using multiple database connections for inserting/updating data into the database.                a) With database auto-commit turn on. In this case, each connection is performed in a manner similar to that described with regard to the single database connection. The performance improvement is substantially proportional to the number of connections. However, there is an issue with regard to scheduling the transactions sequentially to each connection, which could lead to incorrect data being committed. Assuming that there are two transactions A1, A2 to modify the same records in database. A schedule could set A1 in connection 1 and A2 in connection 2. Since there is no guarantee that A1 will reach the database side first, the database side could have first modified the database record first with A2 then A1 and lead to incorrect data by overwritten.        b) With batch commit mode. In this case, each connection is performed in a manner similar to Single database connection with batch commit mode described above. The performance improvement, in this case, is dependent upon the connection number by combining requests in a batch transaction. However, there will be two issues needed to be solved in scheduling batch transactions in multiple connections. One issue is the scheduling issue as previously described (see “a” above). While the other issue is a possible dead lock that could block all connections For example, requests A1 . . . B1 . . . C1 . . . B2 . . . C2 . . . A2 are made to modify database records A, B and C. A sequential schedule could put A1 . . . B2 in connection 1, B1 . . . C2 in connection 2 and C1 . . . A2 in connection 3. When they are sent to database side for execution, connection 1 could finish execute A1 but be blocked at B2 waiting for connection 2 to commit B1 first while connection 2 is blocked at C2 waiting for connection 3 to commit C1 and connection 3 is again blocked at A2 waiting connection 1 to commit A1.        
In an exemplary program for database management, the EMC Corporation Smarts SDI (SQL DATABASE INTERFACE) adapter uses the Single Connection and Single Connection with batch mode methods for inserting/updating data into database.
However, practice has showed that the performance is less than optimal in that delays in inserting/updating may occur. Hence, there is a need in the industry for a method and apparatus for reducing delay time in updating and/or inserting data into a database to provide an increase in data flow and throughput.